package com.designed.pattern.creational.simplefactory;

import com.designed.pattern.creational.simplefactory.core.*;

/**
 * @author yifei
 * @date 2024/3/28
 **/
public class OperationFactory {
    public static Operation createOperation(String operate){
        Operation oper = null;
        switch (operate){
            case "+":
                oper = new Add();
                break;
            case "-":
                oper = new Sub();
                break;
            case "*":
                oper = new Mul();
                break;
            case "/":
                oper = new Div();
        }
        return oper;
    }
}
